// var i;
// var AL_GAME_HUA_AddPrefab = require("./AL_GAME_HUA_AddPrefab");
// var AL_GAME_HUA_CurrencyData = require("./AL_GAME_HUA_CurrencyData");
// var AL_GAME_HUA_GameData = require("./AL_GAME_HUA_GameData");
// var u = cc._decorator;
// var p = u.ccclass;
// var f = u.property;
// var d = (function (e) {
//     function t() {
//         var t = (null !== e && e.apply(this, arguments)) || this;
//         t.icon = null;
//         return t;
//     }
//     __extends(t, e);
//     t.prototype.start = function () {
//         var e = this;
//         ailin_sdk_manager.xianshiCebianlan({
//             node: this.node,
//             gameName: "花朵拼拼",
//             gameIcon: this.icon,
//             onReward: function () {
//                 AL_GAME_HUA_AddPrefab.AddPrefab.zhixing_feixing_jinbi({
//                     count: 7,
//                     fromNode: cc.isValid(e.node) ? e.node : cc.Canvas.instance.node,
//                     onEnd: function () {
//                         AL_GAME_HUA_GameData.GameData.getInstance();
//                         AL_GAME_HUA_CurrencyData.CurrencyData.getInstance().tianjia_huobi({
//                             type: AL_GAME_HUA_CurrencyData.CurrencyType.COIN,
//                             num: 100
//                         });
//                     }
//                 });
//             }
//         });
//     };
//     __decorate([f(cc.SpriteFrame)], t.prototype, "icon", void 0);
//     return __decorate([p], t);
// })(cc.Component);
// exports.default = d;


// 引入必要的模块
const AL_GAME_HUA_AddPrefab = require("./AL_GAME_HUA_AddPrefab");
const AL_GAME_HUA_CurrencyData = require("./AL_GAME_HUA_CurrencyData");
const AL_GAME_HUA_GameData = require("./AL_GAME_HUA_GameData");

//定义ccc的装饰器
const {ccclass, property} = cc._decorator;

/**
 * 这是一个用于处理图标及相关业务逻辑的类。
 */
@ccclass
class IconHandler extends cc.Component {
    /**
     * 图标的SpriteFrame
     * @type {cc.SpriteFrame}
     */
    @property(cc.SpriteFrame)
    icon = null;

    /**
     * 在组件初始化完成后的执行操作。
     */
    start() {
        // 保存当前对象引用，以便后续回调中使用
        const self = this;

        // 显示侧边栏
        ailin_sdk_manager.xianshiCebianlan({
            node: this.node,
            gameName: "花朵拼拼",
            gameIcon: this.icon,
            onReward: function () {
                // 增加金币的逻辑
                AL_GAME_HUA_AddPrefab.AddPrefab.zhixing_feixing_jinbi({
                    count: 7,
                    // 如果当前节点有效使用当前节点, 否则使用Canvas节点
                    fromNode: cc.isValid(self.node) ? self.node : cc.Canvas.instance.node,
                    onEnd: function () {
                        // 获取游戏数据的实例
                        AL_GAME_HUA_GameData.GameData.getInstance();
                        // 增加货币
                        AL_GAME_HUA_CurrencyData.CurrencyData.getInstance().tianjia_huobi({
                            type: AL_GAME_HUA_CurrencyData.CurrencyType.COIN,
                            num: 100
                        });
                    }
                });
            }
        });
    }
}

exports.default = IconHandler;